import request from '@/utils/request'

export const queryProjectsService = ({
  pageSize,
  pageNum,
  projectDelectStatus, //推广项目状态
  auditStatus, //审核状态
}) => {
  // 构造请求体，只包含非 undefined 的参数
  const data = {
    pageNum,
    pageSize,
  }
  if (projectDelectStatus !== undefined) {
    data.projectDelectStatus = projectDelectStatus
  }
  if (auditStatus !== undefined) {
    data.auditStatus = auditStatus
  }
  return request({
    method: 'POST',
    url: '/project/promotionInfo',
    data,
  })
}

export function markProjectService(id) {
  return request({
    method: 'GET',
    url: '/project/markProject/' + id,
    data: { id },
  })
}

export function unmarkProjectService(id) {
  return request({
    method: 'GET',
    url: '/project/cancelMarkProject/' + id,
    data: { id },
  })
}

//根据学校和专业获取学生信息  不需要参数 返回值 学校id 学校名称 专业id 专业名称  学校专业人数
export function getSchoolMajorService() {
  return request({
    method: 'POST',
    url: '/project/getSchoolStudentInfo',
  })
}

//获取指定专业注册人信息
export function getMajorStudentService(majorId) {
  return request({
    method: 'POST',
    url: '/project/getMajorStudentInfo',
    data: { majorId },
  })
}

//修改项目审核状态
export function updateAuditStatusService(param) {
  return request({
    method: 'POST',
    url: '/project/updateAuditStatus',
    data: param,
  })
}
import { deleteProjectService, setMemberCountService } from './t_project'
const projectApi = {
  queryProjectsService,
  markProjectService,
  unmarkProjectService,
  getMajorStudentService,
  getSchoolMajorService,
  updateAuditStatusService,
  deleteProjectService,
  setMemberCountService,
}
export default projectApi
